diff --git a/secded_gen.py b/secded_gen.py
index a299070..835ce13 100755
--- a/secded_gen.py
+++ b/secded_gen.py
@@ -652,17 +652,18 @@ def generate(cfgs, args):
     c_src_filename = args.c_outdir + "/" + "secded_enc.c"
     c_h_filename = args.c_outdir + "/" + "secded_enc.h"
 
-    with open(c_src_filename, "w") as f:
-        f.write(COPYRIGHT)
-        f.write("// SECDED encode code generated by\n")
-        f.write(f"// util/design/secded_gen.py from {SECDED_CFG_FILE}\n\n")
-        f.write(C_SRC_TOP)
-
-    with open(c_h_filename, "w") as f:
-        f.write(COPYRIGHT)
-        f.write("// SECDED encode code generated by\n")
-        f.write(f"// util/design/secded_gen.py from {SECDED_CFG_FILE}\n")
-        f.write(C_H_TOP)
+    if not args.no_c:
+        with open(c_src_filename, "w") as f:
+            f.write(COPYRIGHT)
+            f.write("// SECDED encode code generated by\n")
+            f.write(f"// util/design/secded_gen.py from {SECDED_CFG_FILE}\n\n")
+            f.write(C_SRC_TOP)
+
+        with open(c_h_filename, "w") as f:
+            f.write(COPYRIGHT)
+            f.write("// SECDED encode code generated by\n")
+            f.write(f"// util/design/secded_gen.py from {SECDED_CFG_FILE}\n")
+            f.write(C_H_TOP)
 
     for cfg in cfgs['cfgs']:
         log.debug("Working on {}".format(cfg))
@@ -677,7 +678,7 @@ def generate(cfgs, args):
         write_enc_dec_files(n, k, m, codes, suffix, args.outdir, codetype)
 
         # write out C files, only hsiao codes are supported
-        if codetype in ["hsiao", "inv_hsiao"]:
+        if not args.not_c and (codetype in ["hsiao", "inv_hsiao"]):
             write_c_files(n, k, m, codes, suffix, c_src_filename, c_h_filename,
                           codetype)
 
@@ -691,10 +692,11 @@ def generate(cfgs, args):
         if not args.no_fpv:
             write_fpv_files(n, k, m, codes, suffix, args.fpv_outdir, codetype)
 
-    with open(c_h_filename, "a") as f:
-        f.write(C_H_FOOT)
+    if not args.no_c:
+        with open(c_h_filename, "a") as f:
+            f.write(C_H_FOOT)
 
-    format_c_files(c_src_filename, c_h_filename)
+        format_c_files(c_src_filename, c_h_filename)
 
     # create enum of various ECC types - useful for DV purposes in mem_bkdr_if
     enum_str, inc_str = print_secded_enum_and_util_fns(cfgs['cfgs'])
@@ -1112,6 +1114,9 @@ def main():
     parser.add_argument('--no_fpv',
                         action='store_true',
                         help='Do not generate FPV testbench.')
+    parser.add_argument('--no_c',
+                        action='store_true',
+                        help='Do not generate C files.')
     parser.add_argument('--outdir',
                         default='hw/ip/prim/rtl/',
                         help='''
